<extend name="Base/login_base"/>
<block name="body">
	<script type="text/javascript" src="__STATIC__/qrcode/qrcode.js"></script>
	<script type="text/javascript" src="__STATIC__/qrcode/jquery.qrcode.js"></script>
	<!-- 头部 -->
	<div class="login_header">

		<div class="log_wrap">
			<!--<a href="/" title="乐摇"><img class="logo" src="__IMG__/logo.png"/></a>-->
			<!--
			<div class="nav_r">
				第一次使用？<a href="{:U('User/register')}">立即注册</a>
			</div>
			-->
		</div>

	</div>
	<!-- 介绍 -->

	<div class="top_content">
		<div class="log_wrap">
			<div class="top_content_r">
				<!--<img src="__IMG__/about/img/banner_pic.png?20150723"/>-->
			</div>
			<section class="login_box">
				<form class="login-form" action="__SELF__" method="post">
					<div class="form_body">
						<h6>欢迎登录投票项目后台管理中心</h6>

						<div class="input_panel">
							<div class="control-group">
								<label class="control-label" for="inputEmail">用户名</label>

								<div class="controls">
									<span class="fa fa-user"></span>
									<input type="text" id="inputEmail" class="span3" placeholder="请输入用户名"
									       ajaxurl="/user/checkUserNameUnique.html" errormsg="请填写1-16位用户名"
									       nullmsg="请填写用户名" datatype="*1-16" value="" name="username">

								</div>
							</div>
							<div class="control-group">
								<label class="control-label" for="inputPassword">密码</label>

								<div class="controls">
									<span class="fa fa-key"></span>
									<input type="password" id="inputPassword" class="span3" placeholder="请输入密码"
									       errormsg="密码为6-20位" nullmsg="请填写密码" datatype="*6-20" name="password">
								</div>
							</div>
							<php>if(C('WEB_SITE_VERIFY')) {</php>
							<div class="control-group">
								<label class="control-label" for="inputPassword">验证码</label>

								<div class="controls">
									<span class="fa fa-keyboard-o"></span>
									<input type="text" id="verify" class="span3" placeholder="请输入验证码"
									       errormsg="请填写5位验证码" nullmsg="请填写验证码" datatype="*5-5" name="verify">
									<a href="javascript:;" class="reloadverify_a">换一张?</a>
								</div>
							</div>

							<php> }</php>
						</div>
						<php>if(C('WEB_SITE_VERIFY')) {</php>

						<div class="control-group">
							<label class="control-label"></label>

							<div class="controls" style="margin-top:10px">
								<img class="verifyimg reloadverify" alt="点击切换" src="{:U('verify')}"
								     style="cursor:pointer;">
							</div>
						</div>
						<php> }</php>
						<div class="controls Validform_checktip text-warning"></div>
						<div class="control-group">
							<div class="controls">
								<input type="checkbox" id="checkbox"/><label for="checkbox">自动登录</label>
							</div>
							<div class="controls">
								<button type="submit" class="btn btn-large">登 录</button>
							</div>
							<!--<div class="controls">-->
							<!--还没账号?-->
							<!--</div>-->
							<!--<div class="controls">-->
							<!--<a style="width:280px;" class="btn border-btn-main btn-large" href="{:U('User/register')}">立 即 注 册</a>-->
							<!--</div>-->
						</div>
					</div>
				</form>
			</section>
		</div>
	</div>


</block>
<block name="script">
	<script type="text/javascript">
		$(document)
				.ajaxStart(function () {
					$("button:submit").addClass("log-in").attr("disabled", true);
				})
				.ajaxStop(function () {
					$("button:submit").removeClass("log-in").attr("disabled", false);
				});


		$("form").submit(function () {
			var self = $(this);
			$.post(self.attr("action"), self.serialize(), success, "json");
			return false;

			function success(data) {
				if (data.status) {
					window.location.href = data.url;
				} else {
					self.find(".Validform_checktip").text(data.info);
					//刷新验证码
					$(".reloadverify").click();
				}
			}
		});

		$(function () {
			var verifyimg = $(".verifyimg").attr("src");
			$(".reloadverify,.reloadverify_a").click(function () {
				if (verifyimg.indexOf('?') > 0) {
					$(".verifyimg").attr("src", verifyimg + '&random=' + Math.random());
				} else {
					$(".verifyimg").attr("src", verifyimg.replace(/\?.*$/, '') + '?' + Math.random());
				}
			});
			$('input').focus(function () {
				$(this).parent().find('.fa').css('color', '#44b549');
			})
			$('input').blur(function () {
				$(this).parent().find('.fa').css('color', '#aaa');
			})
		});
	</script>
</block>
